import java.sql.*;

public class CallableStatementTest {
    static Connection conn = null;
    static CallableStatement cs = null;
    static ResultSet rs = null;
    public static void main(String[] args) {
        getUserAndClassById();
    }
    public static void getUserAndClassById() {
        try {
            conn = DBConnection.getConnection();
            String sql = "{call getUserAndClassById(?,?,?)}";
            cs = conn.prepareCall(sql);
            cs.setInt(1,5);
            cs.execute();
            String name = cs.getString(2);
            String sclass = cs.getString(3);
            System.out.println("name="+name+";class="+sclass);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConnection.close(rs,cs,conn);
        }
    }
}